package com.goldfish666.remote_control.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ActiveStateEnum {

    /**
     * 未激活
     */
    inactive(0,"未激活"),

    /**
     * 激活
     */
    active(1,"激活");

    private int value;

    private String desc;

    ActiveStateEnum(int option, String desc) {
        this.value = option;
        this.desc = desc;
    }

    @JsonCreator
    public static ActiveStateEnum fromValue(@JsonProperty("value") final int option) {
        for (ActiveStateEnum e : ActiveStateEnum.values()) {
            if (e.value == option) {
                return e;
            }
        }
        return null;
    }

    public int getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }
}
